using System.Data;
using ET;
namespace DAL
{
    public class Schedule_DAL
    {
        private static readonly clsConnect cls = new clsConnect();

        #region Getdata
        public DataTable BindGirdtb_Schedule(string keywords)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@KeyWords", keywords);
            return cls.GetData("sp_tb_Schedule_Search");
        }
        #endregion

        #region Insert
        public bool Inserttb_Schedule(Schedule_ET data)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Schedule_Title", data.Schedule_Title);
            cls.AddParameter("@Schedule_Date", data.Schedule_Date);
            cls.AddParameter("@Schedule_Time_Start", data.Schedule_Time_Start);
            cls.AddParameter("@Schedule_Time_End", data.Schedule_Time_End);
            cls.AddParameter("@Schedule_Address", data.Schedule_Address);
            cls.AddParameter("@District_ID", data.District_ID);
            cls.AddParameter("@Schedule_Type_ID", data.Schedule_Type_ID);
            cls.AddParameter("@Schedule_Content", data.Schedule_Content);
            cls.AddParameter("@Schedule_Content_Prepare", data.Schedule_Content_Prepare);
            cls.AddParameter("@Schedule_Color", data.Schedule_Color);
            cls.AddParameter("@Schedule_Priority", data.Schedule_Priority);
            cls.AddParameter("@Contact_ID", data.Contact_ID);
            cls.AddParameter("@Schedule_Date_Number", data.Schedule_Date_Number);
            cls.AddParameter("@Schedule_Cancel", data.Schedule_Cancel);
            cls.AddParameter("@Schedule_Reason", data.Schedule_Reason);
            cls.AddParameter("@Schedule_User_Add", data.Schedule_User_Add);
            cls.AddParameter("@Schedule_Date_Add", data.Schedule_Date_Add);
            cls.AddParameter("@Schedule_Computer_Add", data.Schedule_Computer_Add);
            cls.AddParameter("@Schedule_User_Modify", data.Schedule_User_Modify);
            cls.AddParameter("@Schedule_Date_Modify", data.Schedule_Date_Modify);
            cls.AddParameter("@Schedule_Computer_Modify", data.Schedule_Computer_Modify);
            return cls.ExecuteNonQuery("sp_tb_Schedule_Insert");
        }
        #endregion

        #region Update
        public bool Updatetb_Schedule(Schedule_ET data)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Schedule_ID", data.Schedule_ID);
            cls.AddParameter("@Schedule_Title", data.Schedule_Title);
            cls.AddParameter("@Schedule_Date", data.Schedule_Date);
            cls.AddParameter("@Schedule_Time_Start", data.Schedule_Time_Start);
            cls.AddParameter("@Schedule_Time_End", data.Schedule_Time_End);
            cls.AddParameter("@Schedule_Address", data.Schedule_Address);
            cls.AddParameter("@District_ID", data.District_ID);
            cls.AddParameter("@Schedule_Type_ID", data.Schedule_Type_ID);
            cls.AddParameter("@Schedule_Content", data.Schedule_Content);
            cls.AddParameter("@Schedule_Content_Prepare", data.Schedule_Content_Prepare);
            cls.AddParameter("@Schedule_Color", data.Schedule_Color);
            cls.AddParameter("@Schedule_Priority", data.Schedule_Priority);
            cls.AddParameter("@Contact_ID", data.Contact_ID);
            cls.AddParameter("@Schedule_Date_Number", data.Schedule_Date_Number);
            cls.AddParameter("@Schedule_Cancel", data.Schedule_Cancel);
            cls.AddParameter("@Schedule_Reason", data.Schedule_Reason);
            cls.AddParameter("@Schedule_User_Add", data.Schedule_User_Add);
            cls.AddParameter("@Schedule_Date_Add", data.Schedule_Date_Add);
            cls.AddParameter("@Schedule_Computer_Add", data.Schedule_Computer_Add);
            cls.AddParameter("@Schedule_User_Modify", data.Schedule_User_Modify);
            cls.AddParameter("@Schedule_Date_Modify", data.Schedule_Date_Modify);
            cls.AddParameter("@Schedule_Computer_Modify", data.Schedule_Computer_Modify);
            return cls.ExecuteNonQuery("sp_tb_Schedule_Update");
        }
        #endregion

        #region Delete
        public bool Deletetb_Schedule(int id)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Schedule_ID", id);
            return cls.ExecuteNonQuery("sp_tb_Schedule_Delete");
        }
        #endregion
    }
}